Repository navigation
BUG: Refuse a read of pooled element data after its flow data closes - #292
Merged
Merged
Conversation
Since element data started going back to a pool on close, a reference kept after the flow data closed, for example in Flask g or for logging after the with block, could read the next visitor's results with no error. Before pooling, the same read raised that the results had been closed. Element data given back to a pool is now closed for reading, and the pool hands the next request a copy rather than the same object. So a kept reference raises when read and never sees another request's values, and the pool still saves making new instances. Device detection and IP intelligence give their old results closed message, and the other pooled types raise a new one in core saying the flow data has closed. Tests keep a reference, close, process a second request, and check the old reference raises while the new flow data reads its own values, for the core elements, the engines and both on-premise packages. The core readme now says a read after close raises.
Collaborator
Author
|
Merged into rc for the 4.6.2 release. In Pull Requests run 46535380851 at cae118f, every unit suite passed, including the core, engines, device detection on-premise and IP intelligence on-premise tests this change touches. The only failing check is the cloud available properties test, which fails because the CI resource key does not yet include the new ServiceWorkers property. |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Element data goes back to a pool when its flow data closes, and the next request reused the same object. So a reference kept after close, such as
flowdata.devicestored in Flaskgor read for logging after thewithblock, read the next visitor's results with no error. Before pooling, that read raised that the results had been closed.What changes
ElementDataPool) raise a new core message saying the flow data has been closed.Tests
Each test keeps a reference, closes the flow data, processes a second request, and checks that the old reference raises while the new flow data reads its own values. They cover a pooled test element, the four core elements, an engine, and both on-premise packages. The tests that checked the pool returns the same object now check it returns a different one.
Cost
A process and close loop on the default pipeline, which pools all four core elements, took a median of 7,136 microseconds a request against 7,098 before, within the run-to-run spread.